<!--
 * @轮子的作者: 轮子哥
 * @Date: 2023-08-29 15:34:18
 * @LastEditTime: 2023-10-26 09:16:31
-->
<template>
    <el-input v-model="textarea" :autosize="{ minRows: minRows, maxRows: minRows }" type="textarea" :placeholder="defaults" :validate-event="false"
        :style="myStyle" :maxlength="maxlength" show-word-limit/>
</template>
  
<script>
export default {
    name: 'CommonTextarea',
    emits: ['returnData'],
    components: {
    },
    props: {
        defaults: String,
        insertKey: String,
        value: String,
        maxlength:{
            default:255,
            type:Number
        },
        minRows: {
            default: 2
        },
        myStyle: {
            default: {}
        }
    },
    data() {
        return {
            textarea: this.value == null ? '' : JSON.parse(JSON.stringify(this.value)),
        }
    },
    mounted() {
    },
    methods: {
    },
    watch: {
        textarea: {
            handler() {
                let temp = { [this.insertKey]: this.textarea }
                return this.$emit('returnData', temp)
            }
        },
    },
    computed: {
    }

}
</script>
  